package br.ufrj.dcc.thalles;

import android.app.Activity;
import android.database.Cursor;
import android.os.Bundle;
import android.widget.Toast;

public class Saque extends Activity {
	AccountDbAdapter mDbAdapter;
	
	@Override
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		mDbAdapter = new AccountDbAdapter(this);
		mDbAdapter.open();
		String conta;
		String senha;
		Double saldo;
		int ultimoAcesso;
		String tipo;
		conta = "testando Notas";
		senha = "testando corpo";
		tipo ="N";
		ultimoAcesso = 1;
		saldo = 10.5;
		
		mDbAdapter.createNote(conta, senha,saldo,ultimoAcesso,tipo);
		Cursor c = mDbAdapter.fetchAllNotes();
		c.moveToFirst();
		long id = c.getLong(c.getColumnIndex(AccountDbAdapter.KEY_ROWID));
		
		Toast.makeText(this, String.valueOf(c.getDouble(c.getColumnIndex(AccountDbAdapter.KEY_BALANCE))),Toast.LENGTH_SHORT).show();
		
		
		saldo=32.0;
		mDbAdapter.updateNote(id, conta,senha,saldo,ultimoAcesso,tipo);
		
//		
	c= mDbAdapter.fetchNote(id);
	c.moveToFirst();
//		
	Toast.makeText(this, String.valueOf(c.getDouble(c.getColumnIndex(AccountDbAdapter.KEY_BALANCE))),Toast.LENGTH_LONG).show();
//		
	}

}
